<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title></title>
	<style type="text/css">
		*{
			margin: 0;
			padding: 0;
		}
		.box{
			width: 500px;
			height: 500px;
			background: pink;
			padding: 10px;
			border: 5px solid black;
		}
	</style>
</head>
<body>
	<div class="box">
		
	</div>
	<script type="text/javascript">
		var div = document.querySelector('.box')

		//获取盒子宽高的方法
		//1.不包括边框，只包括文本内容宽度和内边距
		console.log('div.clientWidth',div.clientWidth)
		console.log('div.clientHeight',div.clientHeight)

		//2.包括边框，包括文本内容宽度和内边距
		console.log('div.offsetWidth',div.offsetWidth)
		console.log('div.offsetHeight',div.offsetHeight)
	</script>
</body>
</html>